<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>服务信息</title>
    <link rel="stylesheet" type="text/css" href="../../../../css/aui/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../../css/html/issued/post_your_want_frm.css" />
    <style>
        [v-clock] {
            display: none;
        }
    </style>
</head>

<body>
    <div id="app" v-clock>
        <div class="aui-content-padded">
            <div>服务区域</div>
            <textarea name="" id="" class="textarea" v-model="service.service_region" placeholder="请输入服务区域"></textarea>
            <div style="margin-top:1.5rem;">服务项目</div>
            <textarea name="" id="" class="textarea" v-model="service.service_project" placeholder="请填写自己可以服务的工种及范围"></textarea>
            <div style="margin-top:1.5rem;">服务承诺</div>
            <textarea name="" id="" class="textarea" v-model="service.service_commitment" placeholder="请简述自己对服务的承诺"></textarea>
            <div class="btn" @click="submit()">保存</div>
        </div>
    </div>
</body>
<script src="../../../../script/api.js" charset="utf-8"></script>
<script src="../../../../script/aui/aui-tab.js" charset="utf-8"></script>
<script src="../../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../../script/common/check.js" charset="utf-8"></script>
<script src="../../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();

    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {},
            service: {
                user_id: "",
                user_type: "",
                service_region: "",
                service_project: "",
                service_commitment: "",
            }
        },
        methods: {
            init() {
                this.userInfo = get_local('userInfo');
                this.getUserService();
            },
            getUserService() {
                var that = this;
                _ajax(Config.api.UserGetUserService, {
                    user_id: this.userInfo.user_id,
                    user_type: this.userInfo.user_type,
                }, function(ret) {
                    that.service = ret.data;
                    that.service.user_id = that.userInfo.user_id;
                    that.service.user_type = that.userInfo.user_type;
                });
            },
            submit() {
                if (!is_define(this.service.service_region)) {
                    $toast("请输入服务区域");
                    return;
                } else if (!is_define(this.service.service_project)) {
                    $toast("请填写自己可以服务的工种及范围");
                    return;
                } else if (!is_define(this.service.service_commitment)) {
                    $toast("请简述自己对服务的承诺");
                    return;
                }
                _ajax(Config.api.UserUpdataUserService, this.service, function(ret) {
                    if (ret.code === 200) {
                        $toast("保存成功");
                        setTimeout(function() {
                            close_w();
                        }, 1000);
                    }
                });
            }
        }
    });
</script>

</html>
